#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int a, b, c, d;

int main(int argc, char const *argv[])
{
	freopen("init.in", "r", stdin);
	scanf("%d%d%d%d", &a, &b, &c, &d);

	if (d < b)
		printf("%d %d\n", c - a - 1, d - b + 60);
	else
		printf("%d %d\n", c - a, d - b);

	return 0;
}
